home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / doc / python-debian / examples / deb822 / grep_native_packages.py < prev    next >
Encoding:
Python Source  |  2008-08-09  |  667 b   |  23 lines

  1. #!/usr/bin/python
  2.  
  3. # grep the names of all Debian native packages out of Sources files
  4. # Copyright (C) 2007 Stefano Zacchiroli <zack@debian.org>
  5. #
  6. # This program is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10.  
  11. import sys
  12.  
  13. from debian_bundle import deb822
  14.  
  15. for fname in sys.argv[1:]:
  16.     f = file(fname)
  17.     for stanza in deb822.Sources.iter_paragraphs(f):
  18.         pieces = stanza['version'].split('-')
  19.         if len(pieces) < 2:
  20.             print stanza['package']
  21.     f.close()
  22.  
  23.